package com.evil.common.mongo.repository;

import org.springframework.data.mongodb.repository.Query;

import java.io.Serializable;
import java.util.List;

/**
 * @author liyang
 * @date 2025-01-02 14:00
 */
public interface DoubleNameRepository<T, NAME extends Serializable> {

    /**
     * 双主键 任意匹配
     *
     * @param key key
     * @return List
     */
    @Query("{ $or: [ { 'name.singleName': ?0 }, { 'name.doubleName': ?0 } ] }")
    List<T> findBySingleNameOrDoubleName(NAME key);
}
